<?php

class deleteEmploymentContractTypeAction extends sfAction
{

    private $employmentContractTypeService;

    public function getEmploymentContractTypeService()
    {
        if (is_null($this->employmentContractTypeService)) {
            $this->employmentContractTypeService = new EmploymentContractTypeService();
            $this->employmentContractTypeService->setEmploymentContractTypeDao(new EmploymentContractTypeDao());
        }
        return $this->employmentContractTypeService;
    }

    public function execute($request)
    {

        $toBeDeletedEmploymentContractTypeIds = $request->getParameter('chkSelectRow');

        if (!empty($toBeDeletedEmploymentContractTypeIds)) {
            $this->getEmploymentContractTypeService()->deleteEmploymentContractType($toBeDeletedEmploymentContractTypeIds);
            $this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
            $this->redirect('tluadmin/viewEmploymentContractTypeList');
        }
    }

}

